import "ol/ol.css";
import olStyle from "ol/style/Style";
import olstyleText from "ol/style/Text";
import olstyleFill from "ol/style/Fill";
import olstyleCircle from "ol/style/Circle";
import olstyleStroke from "ol/style/Stroke";
import _this from '../main'


export function nulayers() {
    var that = this;

    var TBColors = {
        WTB_SCOLOR: '#ccb0c0', //伪图斑
        WTB_FCOLOR: 'rgba(204, 176, 192,0.7)',
        YL_YDC_SCOLOR: '#177BD0', //宗地已调查
        YL_YZC_SCOLOR: '#15ca8f', //宗地已暂存
        // YL_YDC_FCOLOR:"#ffcc33",
        YL_WDC_SCOLOR: '#ffcc33', //宗地未调查
        // YL_WDC_FCOLOR:"#ffcc33",
        YS_SCOLOR: '#ff0000', //疑似图斑
        CUN_SCOLOR: '#000000', //村界
        CUN_FCOLOR: 'rgba(0,0,0,.1)', //村界
    }

    //行政区中心点样式
    var xzqCenterStyle = function (feature, resolution) {
        var style = new olStyle({
            image: new olstyleCircle({
                radius: 10,
                fill: new olstyleFill({
                    color: 'rgba(255, 0, 0,0.3)',
                }),
            }),
            text: new olstyleText({
                textAlign: 'center', //位置
                textBaseline: 'top', //基准线
                font: 'normal 14px 微软雅黑', //文字样式
                text: feature.get('gName') + " " + feature.get('gYsgs'), //文本内容
                fill: new olstyleFill({
                    color: '#aa3300',
                }),
            })

        })
        return style
    };

    //项目中需要加载的图层
    var layers = {
        xianjie: {
            layerId: 'xianjie',
            visible: false,
            layerUrl:
                'http://110.249.159.162:9997/arcgis/rest/services/NCGDJF/HCFW130000/MapServer',
            layerName: '县界',
            opacity: 0.3,
            zIndex: 1,
        },
        SJZFW: {
            layerId: 'SJZFW',
            layerUrl:
                'http://124.193.79.18:6080/arcgis/rest/services/SJZ20210414/SJZFW/MapServer',
            layerName: '房屋图斑',
            opacity: 1,
            zIndex: 1,
        },
        SJZZD: {
            layerId: 'SJZZD',
            layerUrl:
                'http://124.193.79.18:6080/arcgis/rest/services/SJZ20210414/SJZZD/MapServer',
            layerName: '宗地图斑',
            opacity: 1,
            zIndex: 1,
        },
        SJZYS: {
            layerId: 'SJZYS',
            layerUrl:
                'http://124.193.79.18:6080/arcgis/rest/services/SJZ20210414/SJZYS/MapServer',
            layerName: '疑似图斑',
            opacity: 1,
            zIndex: 1,
        },
        ystbCenterVector: {
            layerId: 'ystbCenterVector',
            layerName: '图斑中心点',
            layerType: 'vectorLayer',
            layerStyle: function (feature, resolution) {
                var style = new olStyle({
                    image: new olstyleCircle({
                        radius: 5,
                        fill: new olstyleFill({
                            color: 'rgba(255, 0, 0,0.8)',
                        }),
                    }),
                    text: new olstyleText({
                        textAlign: 'center', //位置
                        textBaseline: 'top', //基准线
                        font: 'normal 14px 微软雅黑', //文字样式
                        text: feature.get('bsm'), //文本内容
                        fill: new olstyleFill({
                            color: '#ff3300',
                        }),
                    })

                })
                return style
            },
            zIndex: 110,
        }
    };

    return layers;
}